<%@ page import="com.hyy.bean.Merchandise" %>
<%@ page import="java.util.List" %>
<%@ page contentType="text/html;charset=UTF-8" language="java"%>

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/fmt_rt" %>
<html>
<head>
	<title>商品管理中心</title>
	<script src="https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js"></script>
	<!-- 最新版本的 Bootstrap 核心 CSS 文件 -->
	<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
	<!-- 可选的 Bootstrap 主题文件（一般不用引入） -->
	<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous">
	<!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
	<script src="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
</head>
<body>
<div class="container">
	<div class="row">
		<div class="page-header">
			<h1>后台管理系统<small>商品数据管理中心</small></h1>
		</div>
	</div>
	<div class="jumbotron">
		<h1>商品列表</h1>
		<p><a class="btn btn-primary btn-lg" href="/toAddProduct" role="button">添加商品</a></p>
	</div>
	<div class="row">
		<table class="table table-hover table-striped">
			<tr>
				<th>商品编号</th>
				<th>商品名称</th>
				<th>图片路径</th>
				<th>单价</th>
				<th>库存</th>
				<th>销量</th>
				<th>类别</th>
				<th>操作</th>
			</tr>
			<% List<Merchandise> merchandiseList =  (List<Merchandise>)request.getAttribute("merchandises");%>
			<%for(Merchandise merchandise:merchandiseList){%>
				<tr>
					<td><%=merchandise.getId()%></td>
					<td><p style="overflow: hidden;text-overflow:
					ellipsis;white-space:nowrap;width: 250px"><%=merchandise.getProductName()%></p></td>
					<td><p style="overflow: hidden;text-overflow:
					ellipsis;white-space:nowrap;width: 200px"><%=merchandise.getImg()%></p></td>
					<td>￥<%=merchandise.getPrice()%></td>
					<td><%=merchandise.getStock()%>件</td>
					<td><%=merchandise.getSales()%>件</td>
					<td><%=merchandise.getCategoryid()%></td>
					<td>
						<a href="/toUpdateProduct?id=<%=merchandise.getId()%>">修改</a>
						<a href="/deleteProduct?id=<%=merchandise.getId()%>">删除此商品</a>
					</td>
				</tr>
			<% }%>
		</table>
	</div>
</div>
</body>
</html>
